<include file="Public:header" /> <include file="Public:navgation" />

<div class="container-fluid main-content">
  <div class="page-title chart-container"> </div>
  <div class="row">
    <div class="col-md-12">
      <div class="widget-container">
        <div class="heading"> <i class="icon-bar-chart"></i> 工作日志 <a class="btn btn-default btn pull-right" data-toggle="modal" href="#myModal2" >筛选</a>
          <if condition="getAccessMenu($accessList, 'Intesys', 'Info_log', 'insert')"> <a class="btn btn-primary btn pull-right f-fillwidth" data-toggle="modal" href="#myModal">添加</a> </if>
        </div>
        <div class="widget-content padded modal-open">
          <table id="datatable-editable" class="table table-striped table-bordered dataTable">
            <thead>
              <tr>
                <th>标题</th>
                <th class="hidden-xs">时间</th>
                <th>发布人</th>
                <th class="hidden-xs hidden-sm">内容</th>
                <th></th>
              </tr>
            </thead>
            <volist name="list" id="vo" empty="$empty">
              <tr class="data_list {$key}" id="list">
                <td>{$vo.title}</td>
                <td class=" hidden-xs">{:date('Y-m-d',$vo['datetime'])}</td>
                <td>{$vo.name}</td>
                <td class="hidden-xs hidden-sm">{$vo.content}</td>
                <td class="text-center actions"><a class="table-actions fancybox look" data-remark='{$vo.content}' data-id="{$vo['id']}" href="#fancybox"><i class="icon-eye-open"></i></a>
                  <eq name="vo['member_id']" value="$userInfo['id']">
                    <if condition="getAccessMenu($accessList, 'Intesys', 'Info_notice', 'update')"> <a class="table-actions update" data-remark='{$vo.content}' href="{:U('update',array('id'=>$vo['id']))}"><i class="icon-pencil"></i></a> </if>
                    <if condition="getAccessMenu($accessList, 'Intesys', 'Info_notice', 'delete')"> <a class="table-actions delete-row" row="{$key}" href="{:U('delete',array('id'=>$vo['id']))}"><i class="icon-trash text-danger"></i></a> </if>
                  </eq></td>
              </tr>
            </volist>
          </table>
        </div>
      </div>
    </div>
  </div>
  
<script>
$(document).ready(function(e) {
	//addRow(5,[1,2,3,4,5]);
});
$(function(){
	validInsert(function(e){},function(e){
		
		var a = new Array();
		a[0]=e.title;
		a[1]=e.time;
		a[2]=e.persion;
		a[3]=e.content;
		a[4]=e.func;
		addRow(5,a);
	});
});
function addRow(length,data){
   var addTable = document.getElementById("datatable-editable");
   var row_index=1;                           //新插入行在表格中的位置
   var newRow=addTable.insertRow(row_index);  //插入新行
   newRow.id="row"+row_index;                 //设置新插入行的ID
   
   for ( var i=0 ; i<length ; i++) {
		var col=newRow.insertCell(i);
		col.innerHTML=data[i];
	}
}
$(function(){
	validUpdate(function(e){},function(e){
		$("#list").find("td:eq(0)").html($("#myModal3 .form-group").find('[name="title"]').val());
		$("#list").find("td:eq(3)").html($("#myModal3 .form-group  #editorr #ueditor_0").contents().find("body p").html());
	});
});

</script>
  <style>
  .alertdialog{position:absolute; width: 100%;height:50px;bottom:0;text-align:center}
  </style>
  <div class="alertdialog" id="alertdialog" style="display: none;" aria-hidden="true">
    <label class="alertlayble" id="alertlayble">ssssssssssssssss</label>
  </div>
  <div class="modal fade alertdialog" id="alertdialog" style="display: none;" aria-hidden="true">
    <div class="modal-dialog">
      <div class="modal-content">
      	<div class="modal-header">
        	<h4 class="modal-title">修改</h4>
            <div class="modal-body">
            </div>
            <div class="modal-footer">
            </div>
        </div>
      </div>
    </div>         
  </div>
  <!--modal start-->
  <div class="modal fade valid-update" id="myModal3" style="display: none;" aria-hidden="true">
    <div class="modal-dialog">
      <div class="modal-content">
        <form method="post" name="formupdate" class="form-horizontal valid-update" novalidate action="__URL__/update">
          <div class="modal-header">
            <button aria-hidden="true" class="close" data-dismiss="modal" type="button">×</button>
            <h4 class="modal-title">修改</h4>
          </div>
          <div class="modal-body">
            <fieldset>
              <div class="form-group">
                <label class="control-label col-sm-2">标题</label>
                <div class="col-sm-10">
                  <input value="" class="form-control" name="title" type="text" datatype="*">
                </div>
              </div>
              <div class="form-group">
                <label class="control-label col-sm-2">选择员工</label>
                <div class="col-sm-10">
                  <div class="input-group">
                    <input readonly class="form-control f-fillname" type="text">
                    <input name="memberid"  class="form-control" type="hidden">
                    <span class="input-group-btn">
                    <button class="btn btn-default fancybox" href="#fancybox2" type="button">选择</button>
                    </span> </div>
                </div>
              </div>
              <div class="form-group"> 
                <!--<label class="control-label col-sm-2">内容</label>-->
                <div class="col-sm-12">
                  <html:editor id="editorr" name="content" type="UEDIT" style="height:300px; width:100%;"></html:editor>
                </div>
              </div>
            </fieldset>
          </div>
          <div class="modal-footer">
            <button class="btn btn-primary" id="modify" type="submit">确定</button>
            <button class="btn btn-default-outline" data-dismiss="modal" type="button">关闭</button>
          </div>
        </form>
      </div>
    </div>
  </div>
  <!--modal start-->
  <div class="modal fade valid-insert" id="myModal" style="display: none;" aria-hidden="true">
    <div class="modal-dialog">
      <div class="modal-content">
        <form method="post" name="form" class="form-horizontal valid-insert" novalidate action="__URL__/insert">
          <div class="modal-header">
            <button aria-hidden="true" class="close" data-dismiss="modal" type="button">×</button>
            <h4 class="modal-title">添加</h4>
          </div>
          <div class="modal-body">
            <fieldset>
              <div class="form-group">
                <label class="control-label col-sm-2">标题</label>
                <div class="col-sm-10">
                  <input value="" class="form-control" name="title" type="text" datatype="*">
                </div>
              </div>
              <div class="form-group">
                <label class="control-label col-sm-2">选择员工</label>
                <div class="col-sm-10">
                  <div class="input-group">
                    <input readonly class="form-control f-fillname" type="text">
                    <input name="pid"  class="form-control" type="hidden">
                    <span class="input-group-btn">
                    <button class="btn btn-default fancybox" href="#fancybox2" type="button">选择</button>
                    </span> </div>
                </div>
              </div>
              <div class="form-group"> 
                <!--<label class="control-label col-sm-2">内容</label>-->
                <div class="col-sm-12">
                  <html:editor id="editor" name="content" type="UEDIT" style="height:300px; width:100%;"></html:editor>
                </div>
              </div>
            </fieldset>
          </div>
          <div class="modal-footer">
            <button class="btn btn-default" name="type" value="0" type="submit">存储为草稿</button>
            <button class="btn btn-primary" type="submit">确定</button>
            <button class="btn btn-default-outline" data-dismiss="modal" type="button">关闭</button>
          </div>
        </form>
      </div>
    </div>
  </div>
  <!-- modal end and modal2 start-->
  <div class="modal fade" id="myModal2" style="display: none;" aria-hidden="true">
    <div class="modal-dialog">
      <div class="modal-content">
        <form method="post" name="form" class="form-horizontal" novalidate action="__URL__/index">
          <div class="modal-header">
            <button aria-hidden="true" class="close" data-dismiss="modal" type="button">×</button>
            <h4 class="modal-title">筛选</h4>
          </div>
          <div class="modal-body">
            <fieldset>
              <div class="form-group">
                <label class="control-label col-sm-2">职员部门</label>
                <div  class="col-sm-5">
                  <select class="form-control groupid" name="groupid">
                    <option value="">选择部门</option>
                    <foreach name="grouplist" item="vo">
                      <option value="{$vo.id}">{$vo.title}</option>
                    </foreach>
                  </select>
                </div>
                <div class="col-sm-5">
                  <select class="form-control memberid" name="member_id">
                    <option value="">选择职员</option>
                  </select>
                </div>
              </div>
              <div class="form-group">
                <label class="control-label col-sm-2">日期范围</label>
                <div class="col-sm-5" style="z-index:1050;">
                  <input name="starttime" class="form-control" data-date-autoclose="true" data-date-format="dd-mm-yyyy" id="dpd1" placeholder="开始日期" type="text">
                </div>
                <div class="col-sm-5" style="z-index:1050;">
                  <input name="endtime" class="form-control" data-date-autoclose="true" data-date-format="dd-mm-yyyy" id="dpd2" placeholder="结束日期" type="text">
                </div>
              </div>
            </fieldset>
          </div>
          <div class="modal-footer">
            <button class="btn btn-primary" type="submit">筛选</button>
            <button class="btn btn-default-outline" data-dismiss="modal" type="button">关闭</button>
          </div>
        </form>
      </div>
    </div>
  </div>
  <!-- modal end and fancybox start-->
  <div id="fancybox" style="display: none;">
    <h4 class="text-muted">查看</h4>
    <ul class="no-style">
    </ul>
  </div>
  <!-- fancybox end and fancybox start-->
  <div id="fancybox2" style="display: none;">
    <ul class="nav nav-tabs" role="tablist">
      <foreach name="memberlist" item="vo">
        <li role="presentation"><a href="#{$key}" aria-controls="{$key}" role="tab" data-toggle="tab">{$key}</a></li>
      </foreach>
    </ul>
    
    <!-- Tab panes -->
    <div class="tab-content" style="min-height:160px">
      <foreach name="memberlist" item="vo">
        <div role="tabpanel" class="tab-pane" id="{$key}">
          <foreach name="vo" item="ko">
            <label class="checkbox-inline">
              <input name="staff" type="checkbox" value="{$ko.id}">
              <span>{$ko.name}</span></label>
          </foreach>
        </div>
      </foreach>
    </div>
    <div class="col-xs-12">
      <label class="checkbox-inline checkall">
        <input type="checkbox">
        <span>全选</span></label>
      <button class="btn btn-primary btn-md pull-right f-getstaff">确定</button>
    </div>
  </div>
  <!-- fancybox end --> 
</div>
<script>
/*$(".update").click(function(e) {
});*/
$("#datatable-editable").on("click","a.update",function(e){
	e.preventDefault();
    $("#myModal3 form").attr("action",$(this).attr("href"));
    $("#myModal3 .form-group").find('[name="title"]').val($(this).parents(".data_list").find("td:eq(0)").html());
    $("#myModal3 .form-group  #editorr #ueditor_0").contents().find("body p").html($(this).parents(".data_list").find("td:eq(3)").html());
    $("#myModal3").modal("show");
});
/*$(function(){
	validInsert(function(e){},
	function(e){
		//$("#datatable-editable").tBodies[0].html(e.tbody);
	});
});

$(function(){
	validUpdate(function(e){},function(e){
		$("#list").find("td:eq(1)").html($("#myModal3 .form-group").find('[name="title"]').val());
		$("#list").find("td:eq(4)").html($("#myModal3 .form-group  #editorr #ueditor_0").contents().find("body p").html());
	});
});*/


</script> 
<script type="text/javascript" src="http://tajs.qq.com/stats?sId=9051096" charset="UTF-8"></script> 
<include file="Public:footer" />